{% extends "base.html" %}
{% block main %}
    {% if in_reply_to_status is defined %}
        <p class="in-reply-to">In reply to <a
                href="{{ url_for("user", screen_name=in_reply_to_status.user.screen_name) }}">{{ in_reply_to_status.user.screen_name }}</a>:<br/>
            {{ in_reply_to_status.text|safe }}
        </p>
    {% endif %}
    <form action="{{ url_for("status_post") }}" method="post" enctype="multipart/form-data">
        {% if retweet_status is defined and not retweet_status.user.protected %}
            <input type="hidden" value="{{ retweet_status.id_str }}" name="retweet_id" id="retweet_id"/>
            <fieldset>
                <legend>Twitter's new style retweet:</legend>
                <div class="retweet-btn">
                    <input type="submit" value="Twitter Retweet" name="retweet" id="retweet"/>
                </div>
            </fieldset>
        {% endif %}
        <fieldset>
            <legend>
                {% if retweet_status is defined %}
                    Old style editable retweet:
                {% else %}
                    What's Happening?
                {% endif %}
            </legend>
            <textarea name="status" id="status">{{ preset_status }}</textarea>

            <div class="box">
                {% if in_reply_to_status is defined %}
                    <input type="hidden" value="{{ in_reply_to_status.id }}" name="in_reply_to_id" id="in_reply_to_id"/>
                {% endif %}
                <span>
                    <input type="file" name="media[]" id="media[]" size="1"/>
                </span>
                <span class="tweet-btn">
                    {% set word_count=140 - preset_status|default("")|length|int %}
                    <span id="remaining"{% if word_count|int < 0 %} class="red bold"{% endif %}>{{ word_count }}</span>
                    <input type="submit" value="Tweet"/>
                </span>
            </div>

            <div class="tweet-btn">
            </div>
        </fieldset>
    </form>
{% endblock main %}